﻿using System;
using System.Web.UI;

namespace OpenPhotoAlbum.Controls
{
	public class JsMsgBox
	{
		public static void Show(Page page, string message)
		{
			ScriptManager.RegisterStartupScript(
				page,
				page.GetType(),
				Guid.NewGuid().ToString(),
				StringUtility.FormatWithInvariantCulture("window.alert(\'{0}\');", message),
				true);
		}

		public static void Show(Page page, string message, string url)
		{
			ScriptManager.RegisterStartupScript(
				page,
				page.GetType(),
				Guid.NewGuid().ToString(),
				StringUtility.FormatWithInvariantCulture("window.alert(\'{0}\');document.location.href='{1}';", message, url),
				true);
		}
	}
}
